/*
* Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved.
*/

#ifndef VPC_PIPE_CSC_H
#define VPC_PIPE_CSC_H

#include "vpc_pipe_types.h"

#define CSC_COEFF_NUM 24U

typedef enum {
    YUV_TO_RGB,
    RGB_TO_YUV,
    GRAY_TO_RGB,
    RGB_TO_GRAY,
    GRAY_TO_YUV,
    YUV_TO_GRAY,
    RGB_FP32_TO_GRAY,
    RGB_FP32_TO_YUV,
    YUV_FP32_TO_RGB,
    YUV_FP32_TO_GRAY,
    GRAY_FP32_TO_RGB,
    GRAY_FP32_TO_YUV,
    RGB_FP32_TO_GRAY_FP32,
    CSC_TYPE_BUTT
} csc_type_e;

typedef uint8_t fn_judge_support_cvt(vpc_pic_fmt_e infmt, vpc_pic_fmt_e outfmt);

typedef struct color_conv {
    csc_type_e type;
    uint32_t coeff[CSC_COEFF_NUM];
    fn_judge_support_cvt *pfn_judge_support;
} color_conv_t;

void get_csc_coeff(color_conv_t *conv, uint32_t csc_coeff[CSC_COEFF_NUM], const vpc_pipe_csc_info_t *info);
csc_mode_t get_csc_mode(color_conv_t *conv, vpc_pic_fmt_e infmt, vpc_pic_fmt_e outfmt);
csc_mode_t get_data_cvt_csc_mode(vpc_pic_fmt_e infmt, vpc_pic_fmt_e outfmt);
color_conv_t* get_color_conv(vpc_pic_fmt_e infmt, vpc_pic_fmt_e outfmt);

uint8_t judge_u8_field(vpc_pic_fmt_e fmt);
uint8_t judge_fp_field(vpc_pic_fmt_e fmt);
uint8_t judge_fp32_field(vpc_pic_fmt_e fmt);

#endif // #ifndef VPC_PIPE_CSC_H